home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / security / doc / clippings / 930304-01 < prev    next >
Encoding:
Internet Message Format  |  1993-05-21  |  5.1 KB

  1. Date: Thu, 4 Mar 93 12:09:30 PST
  2. From: ???
  3. Subject: Re: Secure X Server Tutorial
  4.  
  5.  
  6. The increasing popularity of the X Window System has brought with it an
  7. ever-growing number of people willing to take advantage of its security
  8. holes.  There are publicly available programs which can display every
  9. character typed to an xterm window.  If you're only using xhost's host-based
  10. method of access control as your means of security, you can assume that
  11. everything you type *including passwords* can be read by a cracker.
  12.  
  13. Fortunately, X provides a way to secure your communications.  This message
  14. addresses how to accomplish this whether you use xdm, openwin or some other
  15. xinit-based method to start up your server.
  16.  
  17. I) XDM
  18.  
  19.   If you're using the Software Warehouse 'xdm' with the default configuration
  20.   files to manage your workstation display, you should already have
  21.   authentication.  If you're using 'xdm' from another source, you may need to
  22.   change a few things to get it working.
  23.  
  24.   The most general method is to edit the xdm-config file.  Simply change the
  25.   'DisplayManager*authorize' resource to 'true'.  You should also verify that
  26.   'DisplayManager._0.authorize' and 'DisplayManager*authComplain' are also
  27.   set to 'true'.  These changes will take effect the next time you start up
  28.   xdm.
  29.  
  30.   If you can't change the xdm-config file for some reason, you can specify
  31.   these resources with the -xrm flag when you start xdm.  Something like
  32.  
  33.     xdm -xrm 'DisplayManager*authorize: true'
  34.  
  35.   will enable authorization.
  36.  
  37. II) xinit (or programs like startx, which use xinit)
  38.  
  39.   If you start X using 'xinit' (which is probably true if you log in using
  40.   the boring old login:/Password: prompts rather than a bitmapped box,) you
  41.   can use the 'xauth' program to set up keys to encrypt a connection.  Here
  42.   are two easy steps to X security:
  43.  
  44.   1) Save the following lines in a file named .xserverrc in your home
  45.      directory:
  46.  
  47.     #!/bin/sh
  48.  
  49.     # generate new authorization keys each time server is started
  50.     #
  51.     for display in :0 `hostname`:0 localhost:0; do
  52.       xauth create $display XDM-AUTHORIZATION-1
  53.     done
  54.  
  55.     # start the server
  56.     #
  57.     exec X :0 -auth ${XAUTHORITY-$HOME/.Xauthority}
  58.  
  59.   *Note*
  60.     The Software Warehouse version of 'xauth' implements the
  61.     non-standard 'create' option, so this probably won't work at other
  62.     sites.  If you don't have access to the Software Warehouse, you
  63.     can create a simple program to generate a random 32 byte string of
  64.     hexadecimal characters (0-9a-f) and replace the 'xauth create...'
  65.     lines with:
  66.  
  67.     xauth add $display XDM-AUTHORIZATION-1 `your-key-program`
  68.  
  69.   2) If you use 'xinit' and specify something after the '--' option, you'll
  70.      need to customize the final line of your .xserverrc file.  For instance,
  71.      if you usually type 'xinit -- XsunMono' (in order to use the smaller
  72.      monochrome Sun server) the final line in your .xserverrc file would be:
  73.  
  74.     exec XsunMono :0 -auth ${XAUTHORITY-$HOME/.Xauthority}
  75.  
  76.   *Another Note*
  77.     If you set the XAUTHORITY environment variable to anything (except
  78.     $HOME/.Xauthority) it must be set BEFORE you run xinit, which does an
  79.     XOpenDisplay() to verify that the server has started.  If the server
  80.     is started with a non-standard '-auth $XAUTHORITY', xinit won't be able
  81.     to contact the server and, after several minutes of annoying messages,
  82.     will kill the server and exit.
  83.  
  84. III) openwin
  85.  
  86.   If you use 'openwin' to start up Sun's X/NeWS server, you can get a secure
  87.   X session by running
  88.  
  89.     openwin -auth magic-cookie
  90.  
  91.  
  92. No matter which way you go about securing your connection, make *sure* to
  93. remove any 'xhost' commands which allow hosts access when you start X.
  94. .xinitrc and .xsession files are good places to check for these.
  95.  
  96. The next time you start X, you should have a more secure connection.
  97. You can confirm this by running 'xhost' with no arguments.  It should say
  98. something like:
  99.  
  100.     access control enabled, only authorized clients can connect
  101.  
  102. This is still not 100% secure, since someone grabbing raw bits off the
  103. network could still manage to intercept your key, but it should deter
  104. most crackers.
  105.  
  106. As long as your home directory is mounted on every machine you use, this is
  107. all you'll need to do.  The authorization file is written in a portable
  108. format which works across architectures.
  109.  
  110.  
  111. If you have two or more home directories, you'll need to transfer your keys
  112. to a file in each home directory before you are be permitted to open new
  113. windows from the machine(s) served by those home directories.  This is
  114. accomplished with the following command:
  115.  
  116.     xauth extract - $DISPLAY | rsh remote-machine xauth merge -
  117.  
  118. (where "remote-machine" is the name of the new machine.)
  119.  
  120. An easier way to do this is to use Software Warehouse version of 'xon' which
  121. has been hacked to support a '-auth' flag.  The command
  122.  
  123.     xon auspex -auth &
  124.  
  125. will start up an xterm window from auspex after making sure your auspex
  126. directory has an up-to-date .Xauthority file.  The command
  127.  
  128.     xon manray -auth xload -geometry =100x50 &
  129.  
  130. will bring up a small xload window from manray after updating the
  131. $XAUTHORITY file there.
  132.  
  133.  
  134.